import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

/**
 * Predefined variables
 * Name = AdShowHelper
 * DateTime = Sat May 07 2022 14:07:36 GMT+0800 (中国标准时间)
 * Author = withtea
 * FileBasename = AdShowHelper.ts
 * FileBasenameNoExtension = AdShowHelper
 * URL = db://assets/scripts/BaseInstance/AdShowHelper.ts
 * ManualUrl = https://docs.cocos.com/creator/3.4/manual/zh/
 *
 */

@ccclass('AdShowHelper')
export default class AdShowHelper {
    private static m_ad_time_index = 0;

    public static CanShow_AD: boolean = true;

    public static SetAfterTimeToCanShowAD(time) {
        console.log('set ad show aftertime ' + time);
        this.CanShow_AD = false;
        let second = time * 1000;
        if (this.m_ad_time_index != 0) {
            clearTimeout(this.m_ad_time_index);
        }
        this.m_ad_time_index = setTimeout(() => {
            this.m_ad_time_index = 0;
            this.CanShow_AD = true;
            console.log('bannertime out ');
        }, second);
    }
}

/**
 * [1] Class member could be defined like this.
 * [2] Use `property` decorator if your want the member to be serializable.
 * [3] Your initialization goes here.
 * [4] Your update function goes here.
 *
 * Learn more about scripting: https://docs.cocos.com/creator/3.4/manual/zh/scripting/
 * Learn more about CCClass: https://docs.cocos.com/creator/3.4/manual/zh/scripting/decorator.html
 * Learn more about life-cycle callbacks: https://docs.cocos.com/creator/3.4/manual/zh/scripting/life-cycle-callbacks.html
 */
